import sevoes from "@/util/Http";
import Qs from "qs";
function couponInquire(data) {//优惠券查询
  return sevoes({
    method: "get",
    params: {
      _gp: "admin.coupon",
      _mt: "queryCouponByTitle",
      ...data
    }
  });
}

function couponAdd(data) {
    //新增
    return sevoes({
      method: "post",
      data: Qs.stringify({
        _gp: "admin.coupon",
        _mt: "addCoupon",
        ...data,
      }),
    });
}

function couponUpdate(data) {
  //编辑
  return sevoes({
    method: "post",
    data: Qs.stringify({
      _gp: "admin.coupon",
      _mt: "updateCoupon",
      ...data,
    }),
  });
}

function couponDelete(data) {
    //删除
    return sevoes({
      method: "post",
      data: Qs.stringify({
        _gp: "admin.coupon",
        _mt: "deleteCoupon",
        ...data,
      }),
    });
  }
  
  function updateCouponStatus(data) {
    //冻结
    return sevoes({
      method: "post",
      data: Qs.stringify({
        _gp: "admin.coupon",
        _mt: "updateCouponStatus",
        ...data,
      }),
    });
  }

function categoryTree() {//获取类目树
    return sevoes({
      method: "get",
      params: {
        _gp: "admin.category",
        _mt: "categoryTree",
      }
    });
  }

export default {couponInquire,categoryTree,couponAdd,couponUpdate,couponDelete,updateCouponStatus}
